package org.jiuling.youbianku.config;

import org.jiuling.basics.validation.Assertions;

/**
 * 邮编库配置
 * @author 紫灵
 * @date 2024年08月21日 15时59分38秒
 */
public class YouBianKuConfig {

    /** 密钥 */
    private String key;

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public void validate() {
        Assertions.StringAssertions.isNotBlank("邮编库密钥不能为空！",this.key);
    }

    /**
     * 建造者
     * @return 建造者对象
     */
    public static Builder builder() {
        return new Builder();
    }

    /**
     * 建造者
     */
    public static class Builder {

        private final YouBianKuConfig youBianKuConfig;

        public Builder() {
            this.youBianKuConfig = new YouBianKuConfig();
        }

        public Builder addKey(String key) {
            this.youBianKuConfig.key = key;
            return this;
        }

        public YouBianKuConfig build() {
            return this.youBianKuConfig;
        }
    }
}
